import request from '@/utils/request'

export function getProductList(params) {
  return request({
    url: '/api/api/products/page',
    method: 'get',
    params
  })
}

export function getProductDetail(productId) {
  return request({
    url: `/api/products/${productId}`,
    method: 'get',
  })
}

export function saveProduct(data) {
  return request({
    url: '/api/api/products/addUpdate',
    method: 'post',
    data
  })
}

export function deleteProduct(id, status) {
  return request({
    url: `/api/api/products/delete/${id}`,
    method: 'delete'
  })
}

export function updateProductStatus(id,status) {
  return request({
    url: `/api/api/products/status/${id}/${status}`,
    method: 'get',
  })
}

export function getCategoryTree() {
  return request({
    url: '/api/api/products/categories',
    method: 'get'
  })
}